<template>
  <div>
    <h3>404页面</h3>
    <div>{{ num }}</div>

    <hr />
    <!-- <router-link to="/home">立即到首页</router-link> -->
    <a href="/home">立即到首页</a>
  </div>
</template>

<script>
export default {
  data() {
    return {
      num: 3
    }
  },
  mounted() {
    this.timer = setInterval(() => {
      this.num--
      console.log(this.num)
      // 声明式导航，客户端导航，不需刷新页面
      // if (this.num == 0) this.$router.push('/home')
      if (this.num == 0) window.location.href = '/home'
    }, 1000)
  },
  beforeDestroy() {
    this.timer && clearInterval(this.timer)
  }
}
</script>

<style lang="scss" scoped></style>
